$("#search_btn").on('click',function(){
	if($("#search_input").val() != "") {
        window.location.href="/nlsc/search_result.php?keyword="+encodeURI($("#search_input").val())+'&nav=10&text=0&lang=' + getQueryString('lang');
	}
})

$("#search_input").keydown(function(event) {
    if (event.keyCode == 13) {
        if($("#search_input").val() != "") {
            window.location.href="/nlsc/search_result.php?keyword="+encodeURI($("#search_input").val())+'&nav=10&text=0&lang=' + getQueryString('lang');
        }
    }
})

//分解URL
function parseURL(url){
	 var url=decodeURI(url);
	 var a =  document.createElement('a');  
	 a.href = url;  
	 return {  
	 source: url,  
	 protocol: a.protocol.replace(':',''),  
	 host: a.hostname,  
	 port: a.port,  
	 query: a.search,  
	 params:(function(){
	 	var ret = {},   
		u=url.split('?')[1]?url.split('?')[1].split('#')[0].split('&'):[];
		for(var i=0;i<u.length;i++){
			ret[u[i].split('=')[0]]=u[i].split('=')[1];
		}
		return ret;
	 })(),
	 file: (a.pathname.match(/\/([^\/?#]+)$/i) || [,''])[1],  
	 hash: a.hash.replace('#',''),  
	 path: a.pathname.replace(/^([^\/])/,'/$1'),  
	 relative: (a.href.match(/tps?:\/\/[^\/]+(.+)/) || [,''])[1],  
	 segments: a.pathname.replace(/^\//,'').split('/')  
	 };  
}
//获取URL参数
function getQueryString(name){
	var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if(r!=null){
    	return  decodeURI(r[2]);
    }
    else if(name == 'lang'){
    	return 'zh';
	}
	else return 'zh';
}
var breadcrumb_zh=[
	{
		"首页":""
	},
	{
		"实验室概况":["实验室简介","行政机构","学术委员会","实验室年报","联系方式"]
	},
	{
		"研究方向":["超导简介","课题组"]
	},
	{
		"人员构成":["研究人员","技术人员","博士后","行政人员","学生"]
	},
	{
		"研究成果":["科研进展","获奖","文章"]
	},
	{
		"学术交流":["学术报告","学术会议"]
	},
	{
		"仪器设备":["课题组主要仪器","公共仪器"]
	},
	{
		"招生招聘":["导师风采","招生信息","招聘信息"]
	},
	{
		"新闻动态":["新闻动态"]
	},
	{
		"通知公告":["通知公告"]
	},
	{
		"搜索结果":["搜索结果"]
	}

]

var breadcrumb_en=[
	{
		"Home":""
	},
	{
		"Overview":["About Us","Organization","Academic Council","Annual Report","Contact us"]
	},
	{
		"Research":["Introduction","Research Groups"]
	},
	{
		"People":["Faculty","Technical Staff","Postdoc","Administration Staff","students"]
	},
	{
		"Achievements":["Research Highlights","Awards","Scientific Publications"]
	},
	{
		"Seminars&Conference":["Seminars","Conference"]
	},
	{
		"Facilities":["Designated facilities","Open facilities"]
	},
	{
		"Education":["supervisor"]
	},
	{
		"News":["News"]
	},
	{
		"Events":["Events"]
	},
	{
		"search":["search"]
	},
	{
		"Open positions":["Open positions"]
	}

]

var nav=getQueryString("nav");
var text=getQueryString("text");
var lang=getQueryString('lang');
if(nav!=8){
	$(".navbar-nav>li").eq(nav).addClass('active').siblings().removeClass('active');
}
$(".containerWrap").css({"min-height":$(window).height()-345});
if(lang=="zh"){
	var t1,t2;
	for(var i in breadcrumb_zh[nav]){
		t1=i;
		t2=breadcrumb_zh[nav][i][text];
	}
	var html='<li>' + t1 + '</li>' + (t2?'<li class="active">' + t2 + '<li>':"");
	if(nav==8||nav==9||nav==10){
		var html='<li>' + t1 + '</li>';
	}
	$(html).appendTo($(".breadcrumb"));
} 
if(lang=="en"){
	var t1,t2;
	for(var i in breadcrumb_en[nav]){
		t1=i;
		t2=breadcrumb_en[nav][i][text];
	}
	var html='<li>' + t1 + '</li>' + (t2?'<li class="active">' + t2 + '<li>':"");
	if(nav==8||nav==9||nav==10||nav==11){
		var html='<li>' + t1 + '</li>';
	}
	$(html).appendTo($(".breadcrumb"));
} 
	
$(".add-link a").each(function(){
	$(this).attr("href",$(this).attr('href') + '&nav=' + nav + '&text='+text + (lang=='zh'?'&lang=zh':'&lang=en'));
})

//list_scientific